<h2>DESCRIPTION</h2>

<em>r.stats.zonal</em> is a tool to analyse exploratory statistics of a 
floating-point "cover layer" according to how it intersects with objects
in a "base layer". A variety of standard statistical measures are possible.
This type of analysis is often called <em>zonal statistics</em>.
The zones are specified as the <b>base</b> raster map and
the statistics are computed from cells in the <b>cover</b> raster map.
Notably, the output of this module is spatial:
The resulting values are recorded as cell values in the <b>output</b> raster map.

<h2>NOTES</H2>

<em>r.stats.zonal</em> is intended to be a partial replacement for
<em><a href="r.statistics.html">r.statistics</a></em>, with support
for floating-point cover maps at the expense of not supporting
quantiles. For this, see <em><a href="r.stats.quantile.html">r.stats.quantile</a></em>.

<h2>EXAMPLE</h2>

In this example, the raster polygon map <tt>zipcodes</tt> in the North 
Carolina sample dataset is used to calculate zonal raster statistics using
the <tt>elevation</tt> raster map: 

<div class="code"><pre>
g.region raster=zipcodes -p

# pixel count in zipcode areas
r.stats.zonal base=zipcodes cover=elevation method=count output=zipcodes_elev_count
r.colors zipcodes_elev_count color=gyr -g

# average elevation in zipcode areas
r.stats.zonal base=zipcodes cover=elevation method=average output=zipcodes_elev_avg
r.colors zipcodes_elev_avg color=elevation -g
</pre></div>

<h2>SEE ALSO</h2>

<ul>
    <li>
        <em><a href="r.stats.quantile.html">r.stats.quantile</a></em>
        for computing quantiles in zones (objects in base raster map),
    </li>
    <li>
        <em><a href="r.quantile.html">r.quantile</a></em>
        for computing quantiles of a whole raster map,
    </li>
    <li>
        <em><a href="r.statistics.html">r.statistics</a></em>
        for categorical (integer) zonal statistics,
    </li>
    <li>
        <em><a href="r.univar.html">r.univar</a></em>
        for zonal statistics with textual (non-spatial) output,
    </li>
    <li>
        <em><a href="v.vect.stats.html">v.vect.stats</a></em>
        for statistics of vector points in vector areas.
    </li>
</ul>

<h2>AUTHOR</h2>
Glynn Clements

<!--
<p>
<i>Last changed: $Date$</i>
-->
